<?php

/**
 * 扩展函数
 *
 * @param array $params
 * @return string
 */
function smarty_function_tpl($params)
{
    extract($params);
    list($class, $action) = explode('/', $url);

    $class     = '\Controller\Controller_' . ucfirst($class);
    $className = '\App\\' . App_Name . $class;
    if (class_exists($className)) {
        $obj = new $className();
        array_shift($params);

        return call_user_func_array(array($obj, $action), array_values($params));
    }
}

